package com.mrd.gtimp.business.action;

import com.mrd.constant.MsgConstants;
import com.mrd.framework.config.web.json.Result;
import com.mrd.gtimp.business.entity.CompanyQp;
import com.mrd.gtimp.business.service.CompanyQpBiz;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


@Controller
@RequestMapping("/business")
public class BusinessUnitsAction {

    @Resource
    private CompanyQpBiz companyQpBiz;


    private static final long serialVersionUID = -4602607009543676666L;


    @RequestMapping("/businessUnits-add")
    public String add() {
        return "add";
    }

    /**
     * 新增或修改信息
     */
    @RequestMapping("/businessUnits-saveOrUpdate")
    @ResponseBody
    public Result saveOrUpdate(CompanyQp companyQp) {
        Result msg;
        try {
            companyQpBiz.saveOrupdateEntity(companyQp);
            msg = Result.newSuccessInstance(MsgConstants.SAVE_SUECCES);
        } catch (Exception e) {
            e.printStackTrace();
            msg = Result.newFailInstance(MsgConstants.SAVE_FAIL);
        }
        return msg;
    }


}
